from rest_framework.views import APIView
from rest_framework.response import Response
from dhm.models.food_cart.food_cart import FoodCart

class FoodCartView(APIView):
    def get(self, request):
        foodcart = FoodCart.objects.all()
        food_cart_list = []
        for food_cart in foodcart:
            food_cart_list.append({
                'id': food_cart.id,
                'photo': food_cart.photo,
                'purpose_photo_one': food_cart.purpose_photo_one,
                'purpose_phone_two': food_cart.purpose_phone_two,
                'purpose_phone_three': food_cart.purpose_phone_three,
                'usage': food_cart.usage,
                'stock': food_cart.stock,
                'price': food_cart.price,
                'title': food_cart.title,
                'size': food_cart.size,
            })
        return Response(food_cart_list)
